<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    <script>
    var obj = {
        name: "abc",
        age: "123",
        card: ['visa', 'mastera'],
        wife: {
            name: 'sdsd',
            son: {
                name: "aaa"
            }
        }
    }
    var obj1 = {

    }
    <!-- 深层拷贝 -->
    function deepClone(origin, target) {
        var target = target || {},
            toStr = Object.prototype.toString,
            arrStr = "[object Array]";
        for (var prop in origin) {
            if (origin.hasOwnProperty(prop)) {
                if (origin[prop] !== 'null' && typeof(origin[prop]) == 'object') {
                    // if (toStr.call(origin[prop]) == arrStr) {
                    //     target[prop] = [];
                    // } else {
                    //     target[prop] = {};
                    // }
                    target[prop] = toStr.call(origin[prop]) == arrStr ? [] : {};
                    deepClone(origin[prop], target[prop]);
                } else {
                    target[prop] = origin[prop];
                }
            }
        }
        return target;
    }
    </script>
</body>

</html>